/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.be;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ChristianATE
 */
@Entity
@Table(name = "tra_expediente")
@NamedQueries({@NamedQuery(name = "Expediente.findAll", query = "SELECT e FROM Expediente e"), @NamedQuery(name = "Expediente.findByExpCodigo", query = "SELECT e FROM Expediente e WHERE e.expCodigo = :expCodigo"), @NamedQuery(name = "Expediente.findByExpFecha", query = "SELECT e FROM Expediente e WHERE e.expFecha = :expFecha"), @NamedQuery(name = "Expediente.findByExpNrofolios", query = "SELECT e FROM Expediente e WHERE e.expNrofolios = :expNrofolios")})
public class Expediente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "exp_codigo")
    private Long expCodigo;
    @Basic(optional = false)
    @Column(name = "exp_fecha")
    @Temporal(TemporalType.DATE)
    private Date expFecha;
    @Basic(optional = false)
    @Column(name = "exp_nrofolios")
    private int expNrofolios;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkExpCodigo", fetch = FetchType.LAZY)
    private List<DocumentoIncluido> documentoIncluidoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkExpCodigo", fetch = FetchType.LAZY)
    private List<Transaccion> transaccionCollection;

    public Expediente() {
    }

    public Expediente(Long expCodigo) {
        this.expCodigo = expCodigo;
    }

    public Expediente(Long expCodigo, Date expFecha, int expNrofolios) {
        this.expCodigo = expCodigo;
        this.expFecha = expFecha;
        this.expNrofolios = expNrofolios;
    }

    public Long getExpCodigo() {
        return expCodigo;
    }

    public void setExpCodigo(Long expCodigo) {
        this.expCodigo = expCodigo;
    }

    public Date getExpFecha() {
        return expFecha;
    }

    public void setExpFecha(Date expFecha) {
        this.expFecha = expFecha;
    }

    public int getExpNrofolios() {
        return expNrofolios;
    }

    public void setExpNrofolios(int expNrofolios) {
        this.expNrofolios = expNrofolios;
    }

    public List<DocumentoIncluido> getDocumentoIncluidoCollection() {
        return documentoIncluidoCollection;
    }

    public void setDocumentoIncluidoCollection(List<DocumentoIncluido> documentoIncluidoCollection) {
        this.documentoIncluidoCollection = documentoIncluidoCollection;
    }

    public List<Transaccion> getTransaccionCollection() {
        return transaccionCollection;
    }

    public void setTransaccionCollection(List<Transaccion> transaccionCollection) {
        this.transaccionCollection = transaccionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (expCodigo != null ? expCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Expediente)) {
            return false;
        }
        Expediente other = (Expediente) object;
        if ((this.expCodigo == null && other.expCodigo != null) || (this.expCodigo != null && !this.expCodigo.equals(other.expCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.tramite.be.Expediente[expCodigo=" + expCodigo + "]";
    }

}
